<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<title>新增文档 - 光年(Light Year Admin)后台管理系统模板</title>
<link rel="icon" href="${APP_PATH}/favicon.ico" type="image/ico">
<meta name="keywords" content="LightYear,光年,后台模板,后台管理系统,光年HTML模板">
<meta name="description" content="LightYear是一个基于Bootstrap v3.3.7的后台管理系统的HTML模板。">
<meta name="author" content="yinqi">

<!--标签插件-->
<link rel="stylesheet" href="public/js/jquery-tags-input/jquery.tagsinput.min.css">

<!--时间选择插件-->
<link rel="stylesheet" href="public/js/bootstrap-datetimepicker/bootstrap-datetimepicker.min.css">
<!--日期选择插件-->
<link rel="stylesheet" href="public/js/bootstrap-datepicker/bootstrap-datepicker3.min.css">

<jsp:include page="/commons.jsp"></jsp:include>

</head>
  
<body>
<div class="lyear-layout-web">
  <div class="lyear-layout-container">
    <!--左侧导航-->
      <jsp:include page="/menu.jsp"></jsp:include>
    <!--End 左侧导航-->
      
    <!--头部信息-->
     <jsp:include page="/head.jsp"></jsp:include>
    <!--End 头部信息-->
    
    <!--页面主要内容-->
    <main class="lyear-layout-content">
      
      <div class="container-fluid">
        
        <div class="row">
          <div class="col-lg-12">
            <div class="card">
              <div class="card-body">
                
                <form   method="post" class="row" id="classForm">
                
                     <input type="hidden" name="uid" id="uid" value="${uid}">
                      
                      
                      <div class="form-group col-md-12">
                    <label for="title">学号</label>
                    <input type="text" class="form-control" id="sno" name="sno" value="" placeholder="请输入姓名" />
                  </div>
                     
                   <div class="form-group col-md-12">
                    <label for="title">姓名</label>
                    <input type="text" class="form-control" id="uname" name="uname" value="" placeholder="请输入姓名" />
                  </div>
                 
                  <div class="form-group col-md-12">
                    <label for="title">转入班级</label>
                    <input type="hidden" class="form-control" id="classid" name="classid" value=""  />
                    <input type="text" class="form-control" id="cname" name="cname" value="" placeholder="请输入姓名" />
                  </div>
                  
                  <div class="form-group col-md-12">
                    <label for="title">状态</label>
                    <input type="text" class="form-control" id="ustatus" name="ustatus" value=""  />
                  </div>
                     
                 
            
                  
                  
               
                 
                  <div class="form-group col-md-12">
                    <button type="button" class="btn btn-primary ajax-post" target-form="add-form" id="btnSubmin">审批通过</button>
                    <button type="button" class="btn btn-default" onclick="javascript:history.back(-1);return false;">返 回</button>
                  </div> 
                  
        </div>
          
               </div>
                   
                </form>
       
              </div>
            </div>
          </div>
          
        </div>
        
      </div>
      
    </main>
    <!--End 页面主要内容-->
  </div>
</div>

<script type="text/javascript" src="public/js/jquery.min.js"></script>
<script type="text/javascript" src="public/js/bootstrap.min.js"></script>
<script type="text/javascript" src="public/js/perfect-scrollbar.min.js"></script>
<!--标签插件-->
<script src="public/js/jquery-tags-input/jquery.tagsinput.min.js"></script>
<script type="text/javascript" src="public/js/main.min.js"></script>
<script src="public/layer/layer.js"></script>
<script src="public/layer/layer.js"></script>
<script>
       $(function(){
    	   var cname=$("#cname").val();
    	   
    		   $.ajax({
      	    	 url:"${APP_PATH}/student/teacherClassList",
      	         type:"post",
      	         success:function(data){
      	        	 var tbodyContent="";
      	        
      	        
      	        	  if(data.msg){	
      	        		   
      	        		  $.each(data.classList,function(index,obj){
      	        			               
      	        	      tbodyContent+="<option  value='"+obj.cid+"'>"+obj.cname+"</option>"
      	        			  
      	        		  });
      	        		  $("#classes").html(tbodyContent);
      	        		  
      	        	 	  
      	                
      	               
      	        	 } 
    
      	         }
      	     }) 
      	          
      	     //
      	      var uid=$("#uid").val();
      	       $.ajax({
      	    	   url:"${APP_PATH}/student/studentList",
      	          type:"post",
      	          data:{"uid":uid},
      	          success:function(data){
      	        	   $("#uname").val(data.user.uname);
      	        	   $("#sno").val(data.user.sno);
      	        	   $("#classid").val(data.user.classes.cid);
      	        	  $("#cname").val(data.user.classes.cname);
      	        	   $("#ustatus").val(data.user.ustatus);
      	          }
      	       }) 
    	   
    	   
    	     //提交
      	    $("#btnSubmin").click(function(){
      	    	$.ajax({
      	    		url:"${APP_PATH}/student/approvals",
      	    		type:"post",
      	    		data:$("#classForm").serialize(),
      	    		success:function(data){
      	    			if(data.msg){
      	    				layer.msg("修改成功",{time:2000,icon:6,shift:4},function(){
  	    		    		  window.location.href="${APP_PATH}/student/supervisorIndex";
  	    		    	  })
      	    				
      	    			}else{
      	    				layer.msg("修改失败",{time:2000,icon:6,shift:4},function(){
  	    		    	
  	    		    	  })
      	    			}
      	    		}
      	    	})
      	    })
      	    	 
      	  
    	     
    	  
    	     
    	     
    	    })
</script>
<!--日期选择插件-->
<script src="public/js/bootstrap-datepicker/bootstrap-datepicker.min.js"></script>
<script src="public/js/bootstrap-datepicker/locales/bootstrap-datepicker.zh-CN.min.js"></script>

</body>
</html>